package com.javasm.service.JINXIAOService.impl;

import com.javasm.commons.basic.BaseServiceImpl;
import com.javasm.service.JINXIAOService.SysRoleService;
import com.javasm.dao.JINXIAODao.SysRoleDao;
import com.javasm.entity.JINXIAOEntity.SysRole;
import com.javasm.util.AliyunSmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleDao, SysRole> implements SysRoleService {

    @Async
    @Override
    public void sendValicode(String loginPhone, String code) {
        //发送休眠几秒
        try {
            Thread.sleep(3000);
            // 阿里云短信发送
            AliyunSmsUtil.sendValicode(loginPhone,code);
            log.info(Thread.currentThread().getName()+"异步线程任务发送短信:"+loginPhone+"-"+code);//发送短信
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}